import request from '@/utils/request'
// 获取组织架构列表
export const getDepartmentsListApi = () => {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

// 根据id删除部门
export const delDepartmentsApi = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

// 获取添加负责人
export const getUserSimpleListApi = () => {
  return request({
    url: '/sys/user/simple',
    method: 'get'
  })
}

// 上传添加的部门
export const addDepartmentApi = (form) => {
  return request({
    url: '/company/department',
    method: 'POST',
    data: form
  })
}

/**
 * 获取部门详情
 * @param {*} id 部门id
 * @returns
 */
export const getDepartmentDetailApi = id => {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 * 修改部门
 * @param {*} data 修改部门的参数
 * @returns
 */
export const editDepartmentApi = data => {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
